const { remote } = require("electron");

const btn1 = document.getElementById("btn1");
const btn2 = document.getElementById("btn2");
const btn3 = document.getElementById("btn3");
const btn4 = document.getElementById("btn4");
const input = document.getElementById("text");

btn1.onclick = () => {
  console.log(myAPI.xyz);
};

btn2.onclick = () => {
  myAPI.savefile(input.value);
};

btn3.onclick = async () => {
  console.log("@@@@@@@@@@@@@@");
  const data = await myAPI.readfile();
  alert(data);
};

btn4.onclick = () => {
  let indexWin = new remote.BrowserWindow({
    width: 200,
    height: 200,
  });
  indexWin.loadFile("../page2/index.html");

  indexWin.on("close", () => {
    indexWin = null;
  });
};
